﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>
<%@ Import Namespace="B2B.Models" %>
<%@Register Assembly="CKEditor.NET" Namespace="CKEditor.NET" TagPrefix="CKEditor"%>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">



</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="HEAD" runat="server">
</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="main_content" runat="server">
  <!--Bắt đầu fastFeedback Wrap gửi yêu cầu mua hàng-->
         <div>
            <div><h3>Send your message to this supplier</h3>

           
            </div>
            <div>
            <%
                string hinhAnh = (string)ViewData["hinhAnh"];
                string maSP = (string)ViewData["maSP"];
                string link = "/Product/ProductDetail/" + maSP;
                string tenSP = (string)ViewData["tenSP"];
                string email = (string)ViewData["email"];
                string hotenNCC = (string)ViewData["hoTen"];
            %>

           <script type="text/javascript">

               function CheckAndSend() {
                   $("#checktdMessage").html("AA");
                   $("#checktdFrom").html("");
                   $("#checktdSubject").html("");
                   var fromMail = document.getElementById("emailNguoiGui");
                   var subject = document.getElementById("subject");
                  // var content = document.getElementById("editor1");
                   
                   var content = CKEDITOR.instances['editor1'].getData();
                  
                   if (fromMail.value == "") {

                       $("#checktdFrom").html("*Please enter your email");
                       fromMail.focus();
                       return false;
                   }
                   if (subject.value.length == 0) {
                       $("#checktdSubject").html("*Please enter subject");
                       subject.focus;
                       return false;
                   }
                   if (content.length < 20) {
                       $("#checktdMessage").html("*Count Character > 20");
                       content.focus;
                       return false;
                   }                   
                   return true;

               }

             

                        </script>

            <form onsubmit="return CheckAndSend()" action="/Product/SendEmailContact" method="post">
                <table border="0">
                    <tr>
                        <th>from:</th>
                        <td>
                            <input type="text" readonly="readonly"  id="emailNguoiGui" name="emailNguoiGui" value="<%=Session["email"].ToString() %>" />
                            <input type="hidden" value="<%=hinhAnh %>" name="hinhAnh" />
                            <input type="hidden" value="<%=maSP %>" name="maSP" />
                            
                            <div style="color:Red" id="checktdFrom"></div>
                        </td>
                    </tr>

                    <tr>
                        <th>To:</th>
                        <td>
                            <div><input type="text" id="emailNguoiNhan" name="emailNguoiNhan" readonly="readonly" value="<%=email %>"/><br />
                            Supplier: <b><%=hotenNCC %></b><br />
                            Product : <a href="<%= link%>"><b><%=tenSP %></b></a>      
                        </td>
                        
                    </tr>

                    <tr>
                        <th>Subject: </th>
                        <td>
                            <input type="text" name="chuDe" id="subject" value="I would like to know more about your product" />
                            <div style="color:Red" id="checktdSubject"></div>
                        </td>
                    </tr>

                    <tr>
                        <th>Message: </th>
                        <td><textarea class="ckeditor" id="editor1" rows="5" cols="15" name="noiDung"></textarea>
                       

                        <div style="color:Red" id="checktdMessage"></div>
                        </td>
                    </tr>
                    <tr>
                        <th>Quantity Needed:</th>
                        <td><input type="text" /> <input type="text" /></td>
                    </tr>
                    <tr>
                        <td colspan="2" align="center">
                            <input type="submit" onclick="CheckAndSend()" value="Send"/>
                        </td>
                    </tr>

                </table>
            </form>
            </div>
         </div>
         <!--Kết thúc fastFeedbackWrap gửi yêu cầu mua hàng-->
</asp:Content>
